Skip to content

fix(anthropic): map webp images explicitly#2304

Open
he-yufeng wants to merge 1 commit into
strands-agents:mainfrom
he-yufeng:fix/anthropic-webp-media-type
Open

fix(anthropic): map webp images explicitly#2304
he-yufeng wants to merge 1 commit into
strands-agents:mainfrom
he-yufeng:fix/anthropic-webp-media-type

Conversation

@he-yufeng
Copy link
Copy Markdown

Fixes the Anthropic WebP part of #2204.

The Anthropic formatter was relying on mimetypes.types_map for image media types. That map is platform/Python-install dependent, so .webp can fall back to application/octet-stream even though Strands already accepts webp as an image format.

This keeps a small explicit map for the Anthropic image formats Strands supports and falls back to mimetypes only for unknown formats.

Validation:

  • python -m pip install -e ".[anthropic]"
  • python -m pytest tests/strands/models/test_anthropic.py -q
  • python -m ruff check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py
  • python -m ruff format --check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py
  • git diff --check

@he-yufeng he-yufeng force-pushed the fix/anthropic-webp-media-type branch from 4f45551 to 2ba48cb Compare May 27, 2026 09:50
@github-actions github-actions Bot added size/s and removed size/s labels May 27, 2026
@he-yufeng
Copy link
Copy Markdown
Author

Rebased this onto current main and revalidated the Anthropic model path. Current head is 2ba48cb. Validation from strands-py: uv sync --extra dev --extra anthropic; uv run pytest tests/strands/models/test_anthropic.py -q --basetemp ...tmp\pytest-2304 -p no:cacheprovider: 58 passed; uv run ruff check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py; uv run ruff format --check src/strands/models/anthropic.py tests/strands/models/test_anthropic.py; python -m py_compile strands-py\src\strands\models\anthropic.py strands-py\tests\strands\models\test_anthropic.py; git diff --check origin/main...HEAD.

@yonib05 yonib05 added the area-provider Related to model providers label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-provider Related to model providers size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants